#define _CRT_SECURE_NO_WARNINGS 1

#include  <stdio.h>
#define N 50
int SearchbyNum(long num[], int score[], int n, long number);

int main()
{
    long  num[N], number;
    int  score[N], n, i, pos;

    scanf("%d", &n);
    for (i = 0; i < n; i++)
        scanf("%ld:%d ", &num[i], &score[i]);
    scanf("%ld", &number);

    pos = SearchbyNum(num, score, n, number);

    if (pos == -1)
        printf("Not found!\n");
    else
        printf("%d\n", score[pos]);

    return 0;
}

int SearchbyNum(long num[], int score[], int n, long number)
{
    int i = 1;
    for (i = 1; i <= N; i++)
    {
        if (number == *num)
        {
            return i - 1;
        }
        num += 1;
    }
    return -1;
}

